Skip to content

Expose Last Index Request Timestamp in Cat Indices API #18405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 25, 2025

Conversation

rgsriram
Copy link
Contributor

Description

This PR enhances the _cat/indices API by adding two new columns to report the timestamp of the last index request processed for each index:

  • last_index_request_timestamp: The raw timestamp in milliseconds since epoch.
  • last_index_request_timestamp.string: The same timestamp in a human-readable UTC ISO 8601 format.

This mirrors the existing approach for creation.date and creation.date.string, providing both a machine-friendly and a human-friendly representation.

Details

  • The last_index_request_timestamp is updated on successful index and delete operations.
  • The cat indices API now exposes both the raw and formatted timestamp columns.
  • The columns can be queried as follows:
    GET _cat/indices?v&h=index,last_index_request_timestamp,last_index_request_timestamp.string

Manual Testing

  • Create an index and index a document.
  • Query the cat indices API with the new columns.
  • Confirm that the millisecond and string columns are present and correct.
  • Index another document and confirm the timestamp updates.
  • Test with multiple indices and edge cases (no docs, deleted index).

Related Issues

Resolves #10766

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Contributor

❌ Gradle check result for 3bfecce: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Jun 1, 2025

❌ Gradle check result for 7678134: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

✅ Gradle check result for 2fc1691: SUCCESS

Copy link

codecov bot commented Jun 21, 2025

Codecov Report

Attention: Patch coverage is 84.84848% with 5 lines in your changes missing coverage. Please review.

Project coverage is 72.70%. Comparing base (d9661c0) to head (874981e).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
.../java/org/opensearch/common/metrics/MaxMetric.java 71.42% 2 Missing ⚠️
...java/org/opensearch/index/shard/IndexingStats.java 81.81% 2 Missing ⚠️
.../opensearch/rest/action/cat/RestIndicesAction.java 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #18405      +/-   ##
============================================
+ Coverage     72.55%   72.70%   +0.14%     
- Complexity    68185    68271      +86     
============================================
  Files          5555     5556       +1     
  Lines        313857   313887      +30     
  Branches      45522    45527       +5     
============================================
+ Hits         227707   228199     +492     
+ Misses        67616    67110     -506     
- Partials      18534    18578      +44     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rgsriram
Copy link
Contributor Author

@andrross - I checked #18544 is merged. I have incorporated all the minor changes. Could you please help me to understand why I am getting the detected breaking change check failure?

@rgsriram rgsriram force-pushed the index-stats-issue-10766 branch from 2fc1691 to eff3086 Compare June 23, 2025 15:13
Copy link
Contributor

❌ Gradle check result for c0184ec: null

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❕ Gradle check result for 8760b58: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@rgsriram
Copy link
Contributor Author

@andrross - Made the changes suggested. Please kindly take a look at it.

Copy link
Contributor

@msfroh msfroh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is looking good now. @andrross, any more feedback from your end?

rgsriram added 11 commits June 24, 2025 22:36
Signed-off-by: Sriram Ganesh <[email protected]>
Signed-off-by: Sriram Ganesh <[email protected]>
Signed-off-by: Sriram Ganesh <[email protected]>
Signed-off-by: Sriram Ganesh <[email protected]>
Signed-off-by: Sriram Ganesh <[email protected]>
Signed-off-by: Sriram Ganesh <[email protected]>
Signed-off-by: Sriram Ganesh <[email protected]>
Signed-off-by: Sriram Ganesh <[email protected]>
@rgsriram rgsriram force-pushed the index-stats-issue-10766 branch from 8760b58 to 26d366b Compare June 24, 2025 17:06
Copy link
Contributor

✅ Gradle check result for 26d366b: SUCCESS

@andrross
Copy link
Member

Looks good to me, @msfroh. I fixed up the changelog so lets merge this when the tests pass again.

Copy link
Contributor

❕ Gradle check result for 874981e: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@msfroh msfroh merged commit 9bfc863 into opensearch-project:main Jun 25, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request Indexing & Search
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants